<?php $v =& $this->validation ?>

<h2><?php echo $this->lang->line('listings_add_new');?></h2>
<!--<h3><?php //echo 'Today is '.$today_date?></h3>-->
<div class="form_error">
    <?=$v->error_string?>
</div>

<?=form_open('member/listings/add')?>
<p><label for="title">* <?=$this->lang->line('listings_title')?>: </label><input type="text" name="title" value="<?=$v->title?>" id="title" class="<?=$v->title_error?>" /></p>
<p>
    <label for="category">* <?=$this->lang->line('listings_category');?>: </label>
    <select name="category" id="category" class="<?=$v->category_error?>">
        <option value="none"><?=$this->lang->line('listings_choose_one');?></option>

        <?php foreach($categories as $category): ?>
            <?php $selected = ($category->category_id == $active) ? 'selected="selected"' : '' ?>
            <?php if( $language=='greek'): ?>
        <option value="<?=$category->category_id?>" <?=$selected?> ><?=$category->name_gr?></option>
            <?php else: ?>
        <option value="<?=$category->category_id?>" <?=$selected?>><?=$category->name?></option>
            <?php endif; ?>
        <?php endforeach ?>
    </select>
</p>

<p><label for="availability">* <?=$this->lang->line('listings_availability');?>: </label>  <?=$tc_calendar?></p>
<p><label for="services">* Services</label>
<input type="radio" name="myradio" value="1" class="services_radio" <?php echo set_radio('myradio', '1', TRUE); ?> /> Only Bed
<br/>
<input type="radio" name="myradio" value="2" class="services_radio" <?php echo set_radio('myradio', '2'); ?> /> Bed and Breakfast
<br/>
<input type="radio" name="myradio" value="3" class="services_radio" <?php echo set_radio('myradio', '3'); ?> /> Half Board
<br/>
<input type="radio" name="myradio" value="4" class="services_radio" <?php echo set_radio('myradio', '4'); ?> /> Full Board
</p>
<p><label for="price">* <?=$this->lang->line('listings_price');?>: </label><input type="text" name="price" value="<?=$v->price?>" id="price" class="<?=$v->price_error?>" /></p>
<p><label for="email">* <?=$this->lang->line('listings_email');?>: </label><input type="text" name="email" value="<?=$v->email?>" id="email" class="<?=$v->email_error?>" /></p>


<h5>Insert the following text in the box:</h5>
<?=$image;?>
<br/>

<br/>
<input type="text" name="captcha" value="" /><?=$this->validation->captcha_error; ?>


<div id="optional" class="js_hide">
    <h3>Personal Information <small>(Optional)</small></h3>
    <p><label for="name">Name: </label></p>
    <p><input type="text" name="name" value="<?=$v->name?>" id="name" class="<?=$v->name_error?>" /></p>
    <p><label for="description"><?=$this->lang->line('listings_description');?>: </label>
        <textarea name="description" id="description" class="<?=$v->description_error?>" rows="8" cols="40"><?=$v->description?>
        </textarea>
    </p>

    <h3><?=$this->lang->line('listings_photos');?></h3>
    <div id="imgtbl" style="display: block;">
        <br>
        <small>
            <em>Images taking too long to upload?</em>  Try reducing their size with image editing software.
        </small>

        <div>
            <img alt="" src="https://post.craigslist.org/imagepreview/no_image/small.gif" id="img1"><br>
            <span id="span1" class="imageLabel">no image yet</span><br>
        </div>

        <div>
            <img alt="" src="https://post.craigslist.org/imagepreview/no_image/small.gif" id="img2"><br>
            <span id="span2" class="imageLabel">no image yet</span><br>
        </div>

        <br clear="all">

        <div>

            <input type="hidden" value="add" id="imgadd1" name="image1">Add:
            <input type="file" name="imgfile1" id="imgfile1">

        </div>
        <div>

            <input type="hidden" value="add" id="imgadd2" name="image2">Add:
            <input type="file" name="imgfile2" id="imgfile2">

        </div>

        <br clear="all">

        <div>
            <img alt="" src="https://post.craigslist.org/imagepreview/no_image/small.gif" id="img3"><br>
            <span id="span3" class="imageLabel">no image yet</span><br>
        </div>

        <div>
            <img alt="" src="https://post.craigslist.org/imagepreview/no_image/small.gif" id="img4"><br>
            <span id="span4" class="imageLabel">no image yet</span><br>
        </div>

        <br clear="all">

        <div>

            <input type="hidden" value="add" id="imgadd3" name="image3">Add:
            <input type="file" name="imgfile3" id="imgfile3">

        </div>

        <div>

            <input type="hidden" value="add" id="imgadd4" name="image4">Add:
            <input type="file" name="imgfile4" id="imgfile4">

        </div>


        <br clear="all">

    </div>
</div>
<p><small><a href="#" id="show_optional" class="hidden js_show more">Show Optional Fields</a></small></p>



<!--<input type="button" name="button2" id="button2" value="Check the value" onClick="javascript:alert('Date select from '+this.form.date3.value+' to '+this.form.date4.value);">-->


<h3>Agreements</h3>
<p>
    <input type="checkbox" name="terms" value="1" id="terms" class="checkbox" <?=$v->set_checkbox('terms', '1')?> />
    <label for="terms" class="checkbox <?=$v->terms_error?>">
				I have read and agree to the <?=anchor('page/tos', 'Terms of Use')?> and <?=anchor('page/privacy', 'Privacy Policy')?>. <sup>(Required)</sup>
    </label>
</p>
<p>
    <input type="checkbox" name="newsletter" value="1" id="newsletter" class="checkbox" <?=$v->set_checkbox('newsletter', '1')?> />
    <label for="newsletter" class="checkbox">
				Yes, I want to be contacted with news and updates.
    </label>
</p>


<p><button type="submit"><?=$this->lang->line('add')?></button></p>
<?php echo form_close();?>
